Adding file descriptor in template.
[and.git] / 10424 - Love calculator / 10424.cpp
blob05d9a3d2386338403e21ecc2e8faa8f89a96d565
1 #include <iostream>
2 #include <string>
3 #include <cmath>
4 #include <cstdlib>
6 using namespace std;
8 #define MAX(a,b) (a>b?a:b)
9 #define MIN(a,b) (a<b?a:b)
11 int main(){
12 string s[2];
13 int n[2];
14 while (getline(cin,s[0]) && getline(cin,s[1])){
15 for (int i=0; i<2; ++i){
16 n[i] = 0;
17 for (int j=0; j<s[i].size(); ++j){
18 char c = tolower(s[i][j]);
19 if (isalpha(c)){
20 n[i] += c - 'a' + 1;
23 n[i] = (n[i]%9>0 ? n[i]%9 : 9);
25 printf("%.2f %\n", (double)MIN(n[0], n[1])*100.0/(double)MAX(n[0], n[1]));
28 return 0;